import { InputQuestion, UploadQuestion, QuestionBase, SelectQuestion } from '@/components/public-template/DynamicForm/dynamic-form-base';

class IndexService {
  getGoBackQuestions() {
    let questions: QuestionBase<any>[] = [
      new SelectQuestion({
        key: 'goBackId',
        label: '退回到',
        value: undefined,
        options: [],
        required: true,
        prompt: '请选择',
        state: {},
        // type: 'text',
        order: 1
      }),
      new InputQuestion({
        key: 'comment',
        label: '意见',
        value: undefined,
        type: 'textarea',
        order: 1
      }),
      // new RadioQuestion({
      //   key: 'key',
      //   label: '审批意见通过邮件发送',
      //   value: 0,
      //   options: [
      //     {
      //       label: '是',
      //       value: 1
      //     },
      //     {
      //       label: '否',
      //       value: 0
      //     }
      //   ],
      //   order: 1
      // }),
      new SelectQuestion({
        key: 'ccs',
        label: '选择抄送人',
        value: undefined,
        options: [],
        type: 'tree',
        placeholder: '请选择抄送人，不能选择机构',
        state: {
          protType: 'post',
          multiple: 'multiple',
          nameKey: 'name',
          nameValue: 'id',
          nameChildren: 'children'
        },
        order: 1
      }),
      new UploadQuestion({
        label: '图片',
        key: 'images',
        state: {
          multiple: true, //开启多个上传
          gird: 12,
          accept: '.jpeg,.png,.jpg',
          isImage: true,
          maxCount: 9
        }
      }),
      new UploadQuestion({
        label: '附件',
        key: 'attachments',
        state: {
          multiple: true, //开启多个上传
          gird: 12,
          listType: 'text',
          maxCount: 9,
          fieldNames: {
            fileId: 'id',
            name: 'name',
            size: 'size',
            suffix: 'suffix',
        
          }
        }
      })
    ];
    return questions.sort((a, b) => a.order - b.order);
  }
  getRejectQuestions() {
    let questions: QuestionBase<any>[] = [
      new InputQuestion({
        key: 'comment',
        label: '意见',
        value: undefined,
        type: 'textarea',
        order: 1
      }),
      // new RadioQuestion({
      //   key: 'key',
      //   label: '审批意见通过邮件发送',
      //   value: 0,
      //   options: [
      //     {
      //       label: '是',
      //       value: 1
      //     },
      //     {
      //       label: '否',
      //       value: 0
      //     }
      //   ],
      //   order: 1
      // }),
      new SelectQuestion({
        key: 'ccs',
        label: '选择抄送人',
        value: undefined,
        options: [],
        type: 'tree',
        placeholder: '请选择抄送人，不能选择机构',
        state: {
          protType: 'post',
          multiple: 'multiple',
          nameKey: 'name',
          nameValue: 'id',
          nameChildren: 'children'
        },
        order: 1
      }),
      new UploadQuestion({
        label: '图片',
        key: 'images',
        state: {
          multiple: true, //开启多个上传
          gird: 12,
          accept: '.jpeg,.png,.jpg',
          isImage: true,
          maxCount: 9
        }
      }),
      new UploadQuestion({
        label: '附件',
        key: 'attachments',
        state: {
          multiple: true, //开启多个上传
          gird: 12,
          listType: 'text',
          maxCount: 9,
          fieldNames: {
            fileId: 'id',
            name: 'name',
            size: 'size',
            suffix: 'suffix',
          }
        }
      })
    ];
    return questions.sort((a, b) => a.order - b.order);
  }
  getAgreeQuestions() {
    let questions: QuestionBase<any>[] = [
      new InputQuestion({
        key: 'comment',
        label: '意见',
        value: undefined,
        type: 'textarea',
        order: 1
      }),
      // new RadioQuestion({
      //   key: 'key',
      //   label: '审批意见通过邮件发送给申请人',
      //   value: 0,
      //   options: [
      //     {
      //       label: '是',
      //       value: 1
      //     },
      //     {
      //       label: '否',
      //       value: 0
      //     }
      //   ],
      //   order: 1
      // }),
      new SelectQuestion({
        key: 'ccs',
        label: '选择抄送人',
        value: undefined,
        options: [],
        type: 'tree',
        placeholder: '请选择抄送人，不能选择机构',
        state: {
          protType: 'post',
          multiple: 'multiple',
          nameKey: 'name',
          nameValue: 'id',
          nameChildren: 'children'
        },
        order: 1
      }),
      new SelectQuestion({
        key: 'nextActivityApprovers',
        label: '选择下级流程处理人',
        value: undefined,
        options: [],
        hidden: true,
        state: {
          mode: 'multiple'
        },
        // type: 'text',
        order: 1
      }),
      new UploadQuestion({
        label: '图片',
        key: 'images',
        state: {
          multiple: true, //开启多个上传
          gird: 12,
          accept: '.jpeg,.png,.jpg',
          isImage: true,
          maxCount: 9
        }
      }),
      new UploadQuestion({
        label: '附件',
        key: 'attachments',
        state: {
          multiple: true, //开启多个上传
          gird: 12,
          listType: 'text',
          maxCount: 9,
          fieldNames: {
            fileId: 'id',
            name: 'name',
            size: 'size',
            suffix: 'suffix',

          }
        }
      })
    ];
    return questions.sort((a, b) => a.order - b.order);
  }
}

export default new IndexService();
